home *** CD-ROM | disk | FTP | other *** search
/ Singles Flirt Up Your Life! (German) / Singles Flirt Up Your Life.iso / data1.cab / Statemachine / plate.lua < prev    next >
Text File  |  2004-01-29  |  1KB  |  39 lines

  1. -- camera state machine
  2.  
  3. beginStateMachine()
  4.  
  5.     onMsg("buildMenu", function(msg)
  6.     
  7.         -- build the pie menu
  8.         clearPieMenu();
  9.         local button;
  10.         button = addPieMenuButton("pm_washDishes", "washDishes");
  11.         button.addDescription(ACTIVITY, "washDishes");       
  12.         button.addDescription(ACTIVITY, "improvePlateTidiness");        
  13.         button.addIcon("guiIconWohnung");
  14.     end )
  15.  
  16.     -- 
  17.     onMsg("washDishes", function(msg)
  18.         -- get character who initiated this action
  19.         local character = getStateObjectFromID(msg.sender);
  20.         -- get the walk state object
  21.         local wso = character.walkSO;
  22.         local wsoContext = StateMachineContext();
  23.         
  24.         local dishwashers = character.getObjectsWithBehavior("dishwasher");
  25.         local dishwasher = dishwashers[1];
  26.         
  27.         if (dishwasher) then
  28.             character.pushCommand("pm_washDishes", "washDishes", dishwasher, "");
  29.             character.popQueueEntry();
  30.         else
  31.             print("no dishwasher found");
  32.             instantAbort(character, EMOTICON_CANNOT, "emoThink")
  33.         end
  34.         
  35.     end )
  36.             
  37.             
  38. endStateMachine()
  39.